<template>
  <div class="dynamic">
    <header>
      <p class="backWrap"><img src="../../../static/img/zuojiantou.png" alt="" @click="back"></p>
      <span>动态详情</span>
      <img src="../../../static/img/fenxiang111.png" alt="">
    </header>
    <section>
      <!--  消息部分  -->
      <div class="msg">
        <div class="msgHead">
          <div class="msg-h-l">
            <p class="msg-h-tx"><img src="../../../static/img/uhead.jpg" alt="">
<!--             <img src="../../../static/img/vip111.png" alt="">-->
            </p>
            <div class="msg-h-dj">
              <div class="msg-h-nick"><span>Anner</span></div>
              <p>学习使我快乐 | 10分钟前</p>
            </div>
          </div>
          <div class="follow" @click="follow">{{isFollow}}</div>
        </div>
        <div class="msg-txt">学习是一种信仰，这话是对的。因为我们每个人要在这个世界上生存，必须要学习，学习是从小就开始了的，经过不断的学....</div>
        <div class="msg-img">
          <img v-for="(x,y) in imgList" :src="x" alt="" @click="lookImg(y)">
        </div>
      </div>
      <div class="qiehuan">
        <router-link tag="div" to="/components/ClientComponents/life/comment" class="qh-item" replace>
          <span :class="present=='comment'?'xz':''">评论123</span>
          <transition name="el-zoom-in-center">
            <p v-show="present=='comment'"></p>
          </transition>
        </router-link>
        <router-link tag="div" to="/components/ClientComponents/life/spotZan" class="qh-item" replace>
          <span :class="present=='spotZan'?'xz':''">点赞233</span>
          <transition name="el-zoom-in-center">
            <p v-show="present=='spotZan'"></p>
          </transition>
        </router-link>
      </div>
      <router-view></router-view>
    </section>

    <van-image-preview v-model="show" :images="imgList" :show-indicators="true" :start-position="index" :show-index="false"></van-image-preview>
  </div>
</template>

<script>

  export default {
    name: "dynamic",
    data() {
      return {
        present: 'comment',
        imgList:['../../../static/img/qwe1.png','../../../static/img/qwe1.png','../../../static/img/qwe1.png'],
        index:0,
        show:false,
        isFollow:'关注'
      }
    },
    methods: {
      back() {
        this.$router.back()
      },
      lookImg(index){
        this.show = true;
        this.index = index;
      },
      follow() {
        this.isFollow = '已关注';
      }
    },
    created() {
      let str = this.$route.path;
      this.present = str.replace('/components/ClientComponents/life/', '');
    },
    watch: {
      $route(to, from) {
        let str = this.$route.path;
        this.present = to.path.replace('/components/ClientComponents/life/', '');
      }
    }
  }
</script>

<style scoped>
  .dynamic {
    width: 100%;
    box-sizing: border-box;
    min-height: 6.67rem;
    padding-top: .5rem;
  }

  header {
    width: 100%;
    height: .5rem;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-flow: row;
    align-items: center;
    justify-content: center;
    padding: 0 .1rem;
    z-index: 88;
    background: linear-gradient(90deg, rgba(255, 142, 65, 1) 0%, rgba(255, 110, 0, 1) 100%);
  }

  .backWrap {
    position: absolute;
    left: .13rem;
    width: .2rem;
    height: .2rem;
    display: flex;
    flex-flow: row;
    align-items: center;
    justify-content: left;
  }
  .backWrap>img {
    width: .10rem;
    height: .18rem;
  }

  header > img:nth-child(3) {
    width: .13rem;
    height: .13rem;
    position: absolute;
    right: .15rem;
  }

  header > span {
    font-size: .18rem;
    font-family: PingFang SC;
    font-weight: 500;
    color: #ffffff;
  }

  section {
    width: 100%;
    box-sizing: border-box;
    padding: .15rem;
  }

  .msg {
    width: 100%;
    box-sizing: border-box;
    background-color: #ffffff;
    padding-bottom: .1rem;
  }

  .msgHead {
    width: 100%;
    height: .32rem;
    display: flex;
    flex-flow: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .15rem;
  }

  .msg-h-l {
    height: 100%;
    display: flex;
    flex-flow: row;
    align-items: center;
  }

  .msg-h-tx {
    position: relative;
  }

  .msg-h-tx > img:nth-child(1) {
    width: .32rem;
    height: .32rem;
  }

  .msg-h-tx > img:nth-child(2) {
    width: .15rem;
    height: .15rem;
    position: absolute;
    right: -.06rem;
    bottom: -.01rem;
  }

  .msg-h-dj {
    height: 100%;
    display: flex;
    flex-flow: column;
    margin-left: .1rem;
    justify-content: space-between;
  }

  .msg-h-dj > p:nth-child(2) {
    font-size: .11rem;
    color: #999999;
    line-height: .11rem;
  }

  .msg-h-nick {
    display: flex;
    flex-flow: row;
    align-items: center;
  }

  .msg-h-nick > p {
    width: .4rem;
    height: .14rem;
    background: rgba(255, 142, 73, 1);
    border-radius: .07rem;
    font-size: .1rem;
    text-align: center;
    line-height: .14rem;
    color: #ffffff;
    margin-left: .1rem;
  }

  .msg-h-nick > span {
    font-size: .15rem;
    color: #333333;
    line-height: .15rem;
  }

  .follow {
    width: .5rem;
    height: .2rem;
    background: rgba(255, 233, 220, 1);
    border-radius: .11rem;
    font-size: .12rem;
    color: #FF8E49;
    line-height: .2rem;
    text-align: center;
  }

  .msg-txt {
    font-size: .13rem;
    color: #666666;
    line-height: .18rem;
    margin-bottom: .1rem;
  }

  .msg-img > img {
    width: 1.12rem;
    height: 1.12rem;
    margin-bottom: .05rem;
  }

  .msg-img {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-between;
    margin-bottom: .1rem;
  }

  .msg-bq > span {
    color: #6F2EEE;
  }

  .msg-dz > p {
    display: flex;
    flex-flow: row;
    align-items: center;
  }

  .msg-dz > p > img {
    width: .17rem;
    margin-right: .05rem;
  }

  .msg-dz > p {
    font-size: 0;
  }

  .msg-dz > p > span {
    font-size: .12rem;
    color: #999999;
  }

  .qiehuan {
    width: 100%;
    height: .55rem;
    box-sizing: border-box;
    border-bottom: .01rem solid #EEEEEE;
    display: flex;
    flex-flow: row;
    align-items: center;
  }

  .qh-item {
    height: 100%;
    margin-right: .2rem;
    display: flex;
    flex-flow: row;
    align-items: center;
    position: relative;
  }

  .qh-item > p {
    width: 100%;
    height: .02rem;
    background-color: #FF7575;
    position: absolute;
    bottom: 0;
  }

  .qh-item > span {
    font-size: .13rem;
    font-family: SourceHanSansCN;
    font-weight: 400;
    color: #999999;
  }

  .xz {
    color: #333333 !important;
  }

/* 预览图下标显示 */
  /deep/ .van-image-preview__index {
    top: .1rem;
    color: #fff;
    font-size: .14rem;
    text-shadow: 0 .01rem .01rem #323233;
  }
  >>> .van-swipe__indicators {
    bottom: .2rem;
  }
  >>> .van-swipe__indicator {
    width: .06rem;
    height: .06rem;
  }
  >>> .van-swipe__indicator:not(:last-child) {
    margin-right: .06rem;
  }
</style>
